package logic

import (
	"context"
	"login-guard/models/mysql"

	"login-guard/loginrpc/internal/svc"
	"login-guard/loginrpc/loginrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListLogic {
	return &ListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ListLogic) List(in *loginrpc.ListRequest) (*loginrpc.ListResponse, error) {
	// todo: add your logic here and delete this line
	var findList []*mysql.Login
	err := mysql.DB.Debug().Find(&findList).Error
	if err == nil {
		return nil, err
	}
	return &loginrpc.ListResponse{}, nil
}
